package com.thunbu.thunbu_meeting_system.viewMdel

import androidx.lifecycle.MutableLiveData
import com.thunbu.lib_common.base.CoroutineViewModel
import com.thunbu.thunbu_meeting_system.await
import com.thunbu.thunbu_meeting_system.bean.TodoWapperModel
import com.thunbu.thunbu_meeting_system.launch
import com.thunbu.thunbu_meeting_system.service.ApiService
import com.thunbu.thunbu_meeting_system.service.MainNet
import com.thunbu.thunbu_meeting_system.toRequestBody

class TodoVM : CoroutineViewModel<Unit>() {
    val todoPage = MutableLiveData<TodoWapperModel>()


    override fun initModel() {

    }

    fun requestList(currentIndex: Int, mPage: Int, originalPage: Int) {
        launch({
            val map = mutableMapOf<String, Any?>("stockStatus" to currentIndex,
                    "current" to mPage,
                    "pageSize" to originalPage)
            val result = MainNet.server(ApiService::class.java).queryAgentList(map.toRequestBody()).await(true,true)
            todoPage.value = result.data
        })
    }
}